require 'watir'
include Watir
require 'test/unit'
require 'test/unit/ui/console/testrunner'
require 'watir/testUnitAddons'
require 'watir/testcase'
require 'watir/contrib/enabled_popup'
class TC_Photos < Test::Unit::TestCase
  def test_14
    gallery = "aaaaagheoitlka"
    $ie.goto($UniVar)
    $ie.refresh()
    
    $ie.link(:text, 'Control Panel').click
    $ie.link(:text, 'Administration').click
    $ie.table(:index, 5).click
    $ie.link(:index, 13).click
    $ie.text_field(:index, 1).value = gallery
    $ie.text_field(:index, 2).value = gallery
    $ie.link(:text, 'Save').click
    $ie.link(:text, 'Exit Control Panel and Return to Site').click
    
    $ie.link(:text, 'Control Panel').click
    $ie.link(:text, 'My Photos').click
    $ie.link(:text, 'Select Photo Gallery to Manage').click
    $ie.link(:text, gallery).click
    $ie.table(:index, 8).click
    $ie.link(:text, 'Post Categorization Settings').click
    $ie.select_list(:index, 1).select('Albums')
    $ie.link(:text, 'Save').click
    $ie.link(:text, 'Exit Control Panel and Return to Site').click
    $ie.link(:text, 'Photos').click
    $ie.link(:text, gallery).click
    assert($ie.contains_text('Album List'))
    
    $ie.link(:text, 'Control Panel').click
    $ie.link(:text, 'Administration').click
    $ie.table(:index, 5).click
    $ie.link(:index, 15).click
    $ie.link(:text, 'Delete').click_no_wait
      hwnd = $ie.enabled_popup(20)
        if(hwnd)
        w = WinClicker.new
        w.clickWindowsButton_hwnd(hwnd, "OK")
        end     
    assert(!$ie.link(:text, gallery).exists?)
  end
end